<!DOCTYPE html>
<html>

<head>
    <title>图书借阅小程序后台管理系统</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <!-- Bootstrap -->
    <link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen">
    <link href="bootstrap/css/bootstrap-responsive.min.css" rel="stylesheet" media="screen">
    <link href="assets/styles.css" rel="stylesheet" media="screen">
    <link href="assets/DT_bootstrap.css" rel="stylesheet" media="screen">
    <!--[if lte IE 8]><script language="javascript" type="text/javascript" src="vendors/flot/excanvas.min.js"></script><![endif]-->
    <!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
    <!--[if lt IE 9]>
    <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
    <script src="vendors/modernizr-2.6.2-respond-1.1.0.min.js"></script>
</head>

<body>
<div class="modal fade" id="add" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title" id="myModalLabel">录入书籍</h4>
            </div>
            <div class="modal-body">
                <form role="form" id="addform" onsubmit="return false" action="#" method="post">
                    <div class="form-group">
                        <label for="name">标题</label>
                        <input type="text" class="form-control" name="title" id="title" style="width: 90%" placeholder="请输入标题" required="required">
                    </div>
                    <div class="form-group">
                        <label for="name">内容</label>
                        <textarea class="form-control" name="info" id="info" placeholder="请输入内容" style="width: 90%" required="required">
                            </textarea>
                    </div>
                    <div style="text-align: center">
                        <button type="submit" id="addbtn" class="btn btn-success">新增</button>
                    </div>
                </form>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal -->
</div>
<div class="navbar navbar-fixed-top">
    <div class="navbar-inner">
        <div class="container-fluid">
            <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"> <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </a>
            <a class="brand" href="index.html">图书借阅小程序后台管理系统</a>
            <div class="nav-collapse collapse">
                <ul class="nav pull-right">
                    <li class="dropdown">
                        <a href="#" role="button" class="dropdown-toggle" data-toggle="dropdown"> <i class="icon-user"></i><span class="adminname"></span>  <i class="caret"></i>

                        </a>
                        <ul class="dropdown-menu">
                            <li>
                                <a tabindex="-1" href="changepassword.html">修改密码</a>
                            </li>
                            <li class="divider"></li>
                            <li>
                                <a tabindex="-1" onclick="logout()" href="#">注销</a>
                            </li>
                        </ul>
                    </li>
                </ul>
            </div>
            <!--/.nav-collapse -->
        </div>
    </div>
</div>
<div class="container-fluid">
    <div class="row-fluid">
        <div class="span3" id="sidebar">
            <ul class="nav nav-list bs-docs-sidenav nav-collapse collapse">
                <li>
                    <a href="index.html"><i class="icon-chevron-right"></i> 主面板</a>
                </li>
                <li>
                    <a href="book.html"><i class="icon-chevron-right"></i> 图书管理</a>
                </li>
                <li>
                    <a href="lent.html"><i class="icon-chevron-right"></i> 借阅管理</a>
                </li>
                <li>
                    <a href="student.html"><i class="icon-chevron-right"></i> 读者管理</a>
                </li>
                <li class="active">
                    <a href="notice.html"><i class="icon-chevron-right"></i> 公告管理</a>
                </li>
            </ul>
        </div>

        <!--/span-->
        <div class="span9" id="content">
            <div class="row-fluid">
                <div class="alert alert-success">
                    <button type="button" class="close" data-dismiss="alert">&times;</button>
                    <h4>欢迎您</h4>
                    本页面可进行数据导入和导出，可进行数据查看，修改，删除，查询</div>
                <div class="navbar">
                    <div class="navbar-inner">
                        <ul class="breadcrumb">
                            <li>
                                <a href="index.html">主面板</a> <span class="divider">/</span>
                            </li>
                            <li class="active">公告管理</li>
                        </ul>
                    </div>
                </div>
            </div>
            <div class="row-fluid">
                <div class="span12">
                    <!-- block -->
                    <div class="block">
                        <div class="navbar navbar-inner block-header">
                            <div class="muted pull-left">功能区</div>
                        </div>
                        <div class="block-content collapse in">
                            <input type="text" placeholder="输入标题搜索" oninput="OnInput(this)" onpropertychange="OnPropChanged(this)" class="form-control" id="title">
                            <input type="text" placeholder="输入内容搜索" oninput="OnInput(this)" onpropertychange="OnPropChanged(this)" class="form-control" id="info">
                            <br>
                            <div class="btn-group">
                                <button class="btn btn-warning" data-toggle="modal" data-target="#add">新增公告</button>
                            </div><!-- /btn-group -->
                        </div>
                    </div>
                    <!-- /block -->
                </div>
            </div>
            <div class="row-fluid">
                <!-- block -->
                <div class="block">
                    <div class="navbar navbar-inner block-header">
                        <div class="muted pull-left">公告管理</div>
                    </div>
                    <div class="block-content collapse in">
                        <div class="span12">
                            <table class="table">
                                <thead>
                                <tr>
                                    <th>#</th>
                                    <th>标题</th>
                                    <th>内容</th>
                                    <th>创建日期</th>
                                    <th>更新日期</th>
                                    <th>操作</th>
                                </tr>
                                </thead>
                                <tbody id="infos">
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
                <!-- /block -->
            </div>
        </div>
    </div>
    <hr>
    <footer>
<!--        <p>&copy; 2024 - 毕业快乐</p>-->
    </footer>
</div>
<!--/.fluid-container-->

<script src="vendors/jquery-1.9.1.js"></script>
<script src="bootstrap/js/bootstrap.min.js"></script>
<script src="vendors/datatables/js/jquery.dataTables.min.js"></script>


<script src="assets/scripts.js"></script>
<script src="assets/DT_bootstrap.js"></script>
<script src="base.js"></script>
<script src="info.js"></script>
<script>
    var type = "notice";
    $(function() {
        var user = iflogin();
        $(".adminname").html(user.aname);

        var info = getall(type);
        pl(info);

        $("#addbtn").attr("url",type);
    });
    function delf(id) {
        del(type,id);
    }
    // Firefox, Google Chrome, Opera, Safari, Internet Explorer from version 9
    function OnInput (event) {
        pl(search(type,event.id,event.value));
    }
    // Internet Explorer
    function OnPropChanged (event) {
        pl(search(type,event.id,event.value));
    }
    function pl(info) {
        $("#infos").html("");
        console.log(info);
        for (let i = 0; i < info.length; i++) {
            var v = info[i];
            $("#infos").append(
                '<tr>' +
                '<td>'+v.id+'</td>' +
                '<td>'+v.title+'</td>' +
                '<td><textarea disabled="disabled" style="height: 100px">'+v.info+'</textarea></td>' +
                '<td>'+v.ct+'</td>' +
                '<td>'+v.ut+'</td>' +
                '<td><a href="'+type+'info.html?id='+v.id+'" class="btn btn-success">详情</a><a onclick="delf('+v.id+')" class="btn btn-danger">删除</a></td>' +
                '</tr>'
            )
        }
    }
</script>
</body>

</html>
